import sys
from loguru import logger as mylogger
import datetime

LOG_FORMAT = '{time:YYYY-MM-DD HH:mm:ss.SSS}  {level}: {message}'
# ROTATION_PERIOD = "2 minutes"
ROTATION_PERIOD = "00:00"
# logger.remove()
# logger.add(sys.stderr, level="ERROR")

VT_LOG_NAME = 'vt_logger'
VtLog = mylogger.bind(name=VT_LOG_NAME)
# VtLog.add("./.vntrader/log/vt_{time:YYYYMMDD_HHmm}.log", rotation=ROTATION_PERIOD, format=LOG_FORMAT, filter=lambda record: record['extra'].get('name') == VT_LOG_NAME, enqueue=True)
VtLog.add("./.vntrader/log/vt_{time:YYYYMMDD}.log", rotation=ROTATION_PERIOD, format=LOG_FORMAT, filter=lambda record: record['extra'].get('name') == VT_LOG_NAME, enqueue=True)

BBC_LOG_NAME = 'bbc_logger'
BbcLog = mylogger.bind(name=BBC_LOG_NAME)
# HftLog.add("./.vntrader/log/hft_{time:YYYYMMDD_HHmm}.log", rotation=ROTATION_PERIOD,  format=LOG_FORMAT, filter=lambda record: record['extra'].get('name') == HFT_LOG_NAME, enqueue=True)
BbcLog.add("./.vntrader/log/bbc_{time:YYYYMMDD}.log", rotation=ROTATION_PERIOD,  format=LOG_FORMAT, filter=lambda record: record['extra'].get('name') == BBC_LOG_NAME, enqueue=True)

MAIN_LOG_NAME = 'main_logger'
MainLog = mylogger.bind(name=MAIN_LOG_NAME)
# MainLog.add("./.vntrader/log/main_{time:YYYYMMDD_HHmm}.log", rotation=ROTATION_PERIOD, format=LOG_FORMAT, filter=lambda record: record['extra'].get('name') == MAIN_LOG_NAME, enqueue=True)
MainLog.add("./.vntrader/log/main_{time:YYYYMMDD}.log", rotation=ROTATION_PERIOD, format=LOG_FORMAT, filter=lambda record: record['extra'].get('name') == MAIN_LOG_NAME, enqueue=True)